package guavatest.beanutilities;

import com.google.common.collect.ComparisonChain;
import guavatest.User;

public class ComparisonChainTest {
    public static void main(String[] args) {
        User user1 = new User("test", "add", 88);
        User user2 = new User("test", "add", 99);

        int result1 = ComparisonChain.start().compare(user1.getAge(), user2.getAge()).result();// -1
        int result2 = ComparisonChain.start().compare(user1.getName(), user2.getName()).result();// 0
        int result3 = ComparisonChain.start().compare(user2.getAge(), user1.getAge()).result();// -1
        System.out.println(result1);
        System.out.println(result2);
        System.out.println(result3);
    }
}
